//
//  AchieveViewTableViewCell.m
//  MySport
//
//  Created by lanou3g on 16/2/27.
//  Copyright © 2016年 ccsobj. All rights reserved.
//

#import "AchieveViewTableViewCell.h"
#import "Masonry.h"


@implementation AchieveViewTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self addviews];
    }return self;
}
-(void)addviews{
    //排名
    self.rankinglabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.rankinglabel];
    [self.rankinglabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).width.insets(UIEdgeInsetsMake(10, 20, 10, 350));
    }];
    
    //头像
    self.image = [[UIImageView alloc] init];
    self.image.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.image];
    self.image.layer.masksToBounds = YES;
    
    [self.image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).width.insets(UIEdgeInsetsMake(5, 50, 5, 290));
        self.image.layer.cornerRadius =  ([UIScreen mainScreen].bounds.size.width-340)/2.0;//设置图片形状
        
    }];
    
    //姓名
    self.namelabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.namelabel];
        self.namelabel.backgroundColor = [UIColor whiteColor];
    [self.namelabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).with.insets(UIEdgeInsetsMake(10, 150, 50, 200));
    }];
    //性别
    self.sexlabel = [[UILabel alloc] init];
        self.sexlabel.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.sexlabel];
    [self.sexlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).with.insets(UIEdgeInsetsMake(40, 150, 10, 210));
    }];
    
    //步数
    self.numberlabel = [[UILabel alloc] init];
    self.numberlabel.font = [UIFont systemFontOfSize:25];//大小
        self.numberlabel.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.numberlabel];
    [self.numberlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).width.insets(UIEdgeInsetsMake(5, 210, 5, 140));
    }];
    //pk按钮
    self.Pkbut = [[UIButton alloc] init];
    self.Pkbut = [UIButton buttonWithType:UIButtonTypeSystem];
    self.Pkbut.backgroundColor = [UIColor whiteColor];
    self.Pkbut.layer.masksToBounds = YES;
    
    [self.contentView addSubview:self.Pkbut];
    [self.Pkbut mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).width.insets(UIEdgeInsetsMake(25, 295, 25, 90));
        self.Pkbut.layer.cornerRadius = ([UIScreen mainScreen].bounds.size.width-385)/2.0;//设置圆角
    }];
    [self.Pkbut setTitle:@"PK" forState:UIControlStateNormal];
    [self.Pkbut addTarget:self action:@selector(PKAtion:) forControlEvents:(UIControlEventTouchUpInside)];
    
    
    
    //关注按钮
    self.attention = [[UIButton alloc] init];
    self.attention = [UIButton buttonWithType:UIButtonTypeSystem];
    self.attention.layer.masksToBounds = YES;
    self.attention.backgroundColor = [UIColor whiteColor];
    [self.attention setImage:[UIImage imageNamed:@"Image"] forState:UIControlStateNormal];
    self.attention.alpha = 0.5;
    [self.contentView addSubview:self.attention];
    [self.attention mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).width.insets(UIEdgeInsetsMake(20, 350, 20, 20));
        self.attention.layer.cornerRadius =  ([UIScreen mainScreen].bounds.size.width-380)/2.0;//设置圆角
    }];
    [self.attention addTarget:self action:@selector(attAtion:) forControlEvents:(UIControlEventTouchUpInside)];
    
}
//PK事件
-(void)PKAtion:(UIButton *)sender{
    self.Pkbut.backgroundColor = [UIColor redColor];
    
    
}
//关注事件
-(void)attAtion:(UIButton *)sender{
    self.attention.backgroundColor = [UIColor redColor];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
